package JZ51_构建乘积数组;

import java.util.ArrayList;

public class Solution {
    public int[] multiply(int[] A) {
        int len = A.length;
        int[] B = new int[len];

        for (int i = 0; i < len; i++){
            int temp = A[i];
            A[i] = 1;
            B[i] = 1;

            for (int j = 0; j < len; j++){
                B[i] *= A[j];
            }

            A[i] = temp;
        }
        return B;
    }
}